package com.czm.art_light.param.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.io.Serializable;

/**
 * 用户登录 请求DTO
 */
@Schema(description = "用户登录 请求DTO")
@EqualsAndHashCode(callSuper = false)
@Data
public class LoginReqDto implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户登录凭证（有效期五分钟）。开发者需要在开发者服务器后台调用 code2Session，
     * 使用 code 换取 openid、unionid、session_key 等信息
     */
    @Schema(description = "用户登录凭证（有效期五分钟）", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message="用户登录凭证不能为空！")
    private String code;

    /**
     * 登录的微信昵称
     */
    @Schema(description = "登录的微信昵称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message="微昵称不能为空！")
    private String nickName;

    /**
     * 登录的微信头像URL
     */
    @Schema(description = "登录的微信头像URL",requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message="头像URL不能为空！")
    @Pattern(regexp = "^(https?):\\/\\/[^\\s/$.?#]+(?:[^\\s]*)?$",message = "头像URL格式不正确！")
    private String avatarUrl;


}
